module EmployeeCertificateRepositiory
  
  def check_everyone_certificate_valid_end
    find_valid_certificates
  end

  def find_valid_certificates
    EmployeeCertificate.where(state: 'normal')
                         .where("valid_end <= '#{Time.now.to_date}'")
  end

  def find_will_valid_certificates
    EmployeeCertificate.where(state: 'normal')
                         .where("recheck_time <= '#{Time.now.to_date}' and valid_end > '#{Time.now.to_date}'")
  end
end